import { UserAdd, ConnectTreeStore } from '@/components/TenantUserAdd';

class NoticeUserAddTable extends UserAdd {

  // override
  componentDidMount() {
    this.getRootOrg();
    const { users = [] } = this.props;
    this.setState({ checkedNodes: users || [] });
  }

  handleDelete = (record) => {
    const { checkedNodes } = this.state;

    const aftercheckedNodes = checkedNodes.filter(
      (item) => item.userCode !== record.userCode,
    );
    this.setState({ checkedNodes: aftercheckedNodes });
  }

  handleOk = (e) => {
    if (e && e.preventDefault) e.preventDefault();
    const { onOk } = this.props;
    const { checkedNodes } = this.state;
    onOk(checkedNodes)
    this.handleCancel();
  };

  render() {
    return super.render();
  }
}
export default ConnectTreeStore(NoticeUserAddTable);
